<?php

namespace app\admin\model\dahui;

use think\Model;

class Bujiao extends Model
{
    // 表名
    protected $name = 'dahui_bujiao';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'businesstype_text',
        'auditstatus_text',
        'overduestatus_text',
        'preprocessing_text',
        'refundornot_text'
    ];
    

    
    public function getBusinesstypeList()
    {
        return ['社保' => __('社保'),'个税' => __('个税'),'公积金' => __('公积金'),'补充公积金' => __('补充公积金')];
//        return ['补充公积金' => __('补充公积金'), '个税' => __('个税'), '公积金' => __('公积金'), '社保' => __('社保')];
    }     

    public function getAuditstatusList()
    {
        return ['已审核' => __('已审核'),'未审核' => __('未审核'),'' => __('')];
    }     

    public function getOverduestatusList()
    {
        return ['未办理' => __('未办理'),'已办理' => __('已办理'),'部分失败' => __('部分失败'),'' => __('')];
    }     

    public function getPreprocessingList()
    {
        return ['' => __(''),'是' => __('是')];
    }     

    public function getRefundornotList()
    {
        return ['' => __(''),'已退款' => __('已退款'),'待退款' => __('待退款'),'需退款' => __('需退款')];
    }     


    public function getBusinesstypeTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['businesstype']) ? $data['businesstype'] : '');
        $list = $this->getBusinesstypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getAuditstatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['auditstatus']) ? $data['auditstatus'] : '');
        $list = $this->getAuditstatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getOverduestatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['overduestatus']) ? $data['overduestatus'] : '');
        $list = $this->getOverduestatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPreprocessingTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['preprocessing']) ? $data['preprocessing'] : '');
        $list = $this->getPreprocessingList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getRefundornotTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['refundornot']) ? $data['refundornot'] : '');
        $list = $this->getRefundornotList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function kehu()
    {
        return $this->belongsTo('Kehu', 'idnumber', 'idnumber', [], 'left')->setEagerlyType(0);
        
    }
}
